<?php

namespace McUser\Model;
use Common\Model\CommonModel;

/*
 *  Copyright (c) 2014 The CCP project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a Beijing Speedtong Information Technology Co.,Ltd license
 *  that can be found in the LICENSE file in the root of the web site.
 *
 *   http://www.yuntongxun.com
 *
 *  An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

class WalletBankModel extends CommonModel {

	function _initialize(){}

	protected $trueTableName = 'bg_wallet_bank';
	protected $dbName = 'thinkcmf';
	//protected $tablePrefix = 'bg_';

	/*
	*	修改银行提款信息
	*/
	public function change_bank_account($userID, $bankName, $bankAccount, $bankUserName){

		$where['userID'] = $userID;

		$data['userID'] = $userID;
		$data['bankName'] = $bankName;
		$data['bankAccount'] = $bankAccount;
		$data['bankUserName'] = $bankUserName;
		$data['changeDate'] = date('Y-m-d H:i:s', time());
		
		$result = $this -> where($where) -> find();
		if($result)
			$this -> where($where) -> save($data);
		else
			$this -> add($data);

	}

	/*
	*	 读取银行账号信息
	*/
	public function read_bank_account($userID){
		$where['userID']=$userID;

	    $result = $this->where($where)->select();

	    return $result;
	}

}